package com.zby.springbootdemo.dao;

import com.zby.springbootdemo.entity.s;
import org.apache.ibatis.jdbc.SQL;

public class sSqlProvider {

    public String insertSelective(s record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("s");
        
        if (record.getSNO() != null) {
            sql.VALUES("SNO", "#{SNO,jdbcType=INTEGER}");
        }
        
        if (record.getAGE() != null) {
            sql.VALUES("AGE", "#{AGE,jdbcType=INTEGER}");
        }
        
        if (record.getSNAME() != null) {
            sql.VALUES("SNAME", "#{SNAME,jdbcType=VARCHAR}");
        }
        
        if (record.getSEX() != null) {
            sql.VALUES("SEX", "#{SEX,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(s record) {
        SQL sql = new SQL();
        sql.UPDATE("s");
        
        if (record.getAGE() != null) {
            sql.SET("AGE = #{AGE,jdbcType=INTEGER}");
        }
        
        if (record.getSNAME() != null) {
            sql.SET("SNAME = #{SNAME,jdbcType=VARCHAR}");
        }
        
        if (record.getSEX() != null) {
            sql.SET("SEX = #{SEX,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("SNO = #{SNO,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}